Drop gtk_get_current_ apis
authorMatthias Clasen <mclasen@redhat.com>
Sat, 11 Apr 2020 19:04:52 +0000 (15:04 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 11 Apr 2020 21:29:27 +0000 (17:29 -0400)
We have event controller apis to replace these.
There is one remaining use of gtk_get_current_event_time
in gtkwindow.c, so we can't drop the implementation yet.

Add a section in the migration guide for this.

docs/reference/gtk/gtk4-sections.txt
docs/reference/gtk/migrating-3to4.xml
gtk/gtkmain.c
gtk/gtkmain.h
gtk/gtkprivate.h

index 64c459a19729fbc5c3a0c3fbf59267d1c325433d..338ea2b06a9ead86647c045b293e32864e59df36 100644 (file)
@@ -4287,12 +4287,6 @@ gtk_init_check
 <SUBSECTION>
 GTK_PRIORITY_RESIZE
 
-<SUBSECTION>
-gtk_get_current_event
-gtk_get_current_event_time
-gtk_get_current_event_state
-gtk_get_current_event_device
-
 <SUBSECTION Private>
 gtk_init_abi_check
 gtk_init_check_abi_check
index 570bdca0d726e30f371600232d3ec4df1c5ea174..bb44f1a8a44d693f3396045e58312ec64c15c090 100644 (file)
       </para>
     </section>
 
+    <section>
+      <title>Stop using gtk_get_current_... APIs</title>
+      <para>
+        The function gtk_get_current_event() and its variants have been
+        replaced by equivalent event controller APIs:
+        gtk_event_controller_get_current_event(), etc.
+      </para>
+    </section>
+
     <section>
       <title>Adapt to surface API changes</title>
       <para>
index 986e7ae8a03448d8b13834c6c53349b41daa8fd3..a34d2a8f8407392c3555329ec8b3babdeb02336b 100644 (file)
@@ -2014,37 +2014,6 @@ gtk_grab_remove (GtkWidget *widget)
     }
 }
 
-/**
- * gtk_get_current_event:
- *
- * Obtains a reference of the event currently being processed by GTK.
- *
- * For example, if you are handling a #GtkButton::clicked signal,
- * the current event will be the #GdkEventButton that triggered
- * the ::clicked signal.
- *
- * Returns: (transfer full) (nullable): a reference of the current event, or
- *     %NULL if there is no current event. The returned event must be
- *     freed with g_object_unref().
- */
-GdkEvent*
-gtk_get_current_event (void)
-{
-  if (current_events)
-    return gdk_event_ref (current_events->data);
-  else
-    return NULL;
-}
-
-/**
- * gtk_get_current_event_time:
- *
- * If there is a current event and it has a timestamp,
- * return that timestamp, otherwise return %GDK_CURRENT_TIME.
- *
- * Returns: the timestamp from the current event,
- *     or %GDK_CURRENT_TIME.
- */
 guint32
 gtk_get_current_event_time (void)
 {
@@ -2054,51 +2023,6 @@ gtk_get_current_event_time (void)
     return GDK_CURRENT_TIME;
 }
 
-/**
- * gtk_get_current_event_state:
- * @state: (out): a location to store the state of the current event
- *
- * If there is a current event and it has a state field, place
- * that state field in @state and return %TRUE, otherwise return
- * %FALSE.
- *
- * Returns: %TRUE if there was a current event and it
- *     had a state field
- */
-gboolean
-gtk_get_current_event_state (GdkModifierType *state)
-{
-  g_return_val_if_fail (state != NULL, FALSE);
-
-  if (current_events)
-    {
-      *state = gdk_event_get_modifier_state (current_events->data);
-      return TRUE;
-    }
-  else
-    {
-      *state = 0;
-      return FALSE;
-    }
-}
-
-/**
- * gtk_get_current_event_device:
- *
- * If there is a current event and it has a device, return that
- * device, otherwise return %NULL.
- *
- * Returns: (transfer none) (nullable): a #GdkDevice, or %NULL
- */
-GdkDevice *
-gtk_get_current_event_device (void)
-{
-  if (current_events)
-    return gdk_event_get_device (current_events->data);
-  else
-    return NULL;
-}
-
 /**
  * gtk_get_event_widget:
  * @event: a #GdkEvent
index 16fb5743d53a7140067eb4683714a36f09accd5a..ba1e1ac9f887c649b9801240079f64d914319cef 100644 (file)
@@ -107,15 +107,6 @@ PangoLanguage *gtk_get_default_language (void);
 GDK_AVAILABLE_IN_ALL
 GtkTextDirection gtk_get_locale_direction (void);
 
-GDK_AVAILABLE_IN_ALL
-GdkEvent * gtk_get_current_event        (void);
-GDK_AVAILABLE_IN_ALL
-guint32    gtk_get_current_event_time   (void);
-GDK_AVAILABLE_IN_ALL
-gboolean   gtk_get_current_event_state  (GdkModifierType *state);
-GDK_AVAILABLE_IN_ALL
-GdkDevice *gtk_get_current_event_device (void);
-
 
 G_END_DECLS
 
index 9e8300d1a306f5db8662dae11e072c6a6853e50c..4985f2d125bd6de8233dfca7b6adcf8246dfad95 100644 (file)
@@ -91,6 +91,8 @@ void       gtk_main_do_event       (GdkEvent           *event);
 
 GtkWidget *gtk_get_event_widget         (GdkEvent  *event);
 
+guint32    gtk_get_current_event_time   (void);
+
 void check_crossing_invariants (GtkWidget       *widget,
                                 GtkCrossingData *crossing);